diff -c ./readline.c /home/scott/work/bash-1.08/readline/readline.c
*** ./readline.c	Mon May 20 05:19:43 1991
--- /home/scott/work/bash-1.08/readline/readline.c	Fri Aug 23 02:13:53 1991
***************
*** 30,35 ****
--- 30,44 ----
  static char *xmalloc (), *xrealloc ();
  #endif
  
+ /**
+  ** (sjk)++ On an Atari we need these for the xconsole routines and the 
+  ** definitions of the scan codes for the extended keyboard.
+  **/
+ #if defined(atarist)
+ #include <osbind.h>
+ #include <keycodes.h>
+ #endif
+ 
  #include <stdio.h>
  #include <sys/types.h>
  #include <fcntl.h>
***************
*** 48,55 ****
  #include <unistd.h>
  #endif
  
! #define NEW_TTY_DRIVER
! #define HAVE_BSD_SIGNALS
  /* #define USE_XON_XOFF */
  
  /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
--- 57,64 ----
  #include <unistd.h>
  #endif
  
! #define NEW_TTY_DRIVER 
! /* #define HAVE_BSD_SIGNALS */
  /* #define USE_XON_XOFF */
  
  /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
***************
*** 84,89 ****
--- 93,106 ----
  #include <sgtty.h>
  #endif
  
+ /** 
+  ** (sjk)++ sgtty.h defines META on the Atari ST, so we must undefine it so we 
+  **         get the proper definition of the META macro from readline.h
+  **/
+ #if defined(atarist)
+ #undef META
+ #endif
+ 
  #include <errno.h>
  extern int errno;
  
***************
*** 170,175 ****
--- 187,193 ----
  #define HANDLE_SIGNALS
  
  
+ 
  /* **************************************************************** */
  /*								    */
  /*			Line editing input utility		    */
***************
*** 289,294 ****
--- 307,332 ----
  /*								    */
  /* **************************************************************** */
  
+ 
+ /**
+  ** (sjk)++ To get the keyboard mapping right we use the I/O routines 
+  **         from xconsole.c in the termcap library. Here we initialize 
+  **         a few of the more common keys.
+  **/
+ #if defined(atarist)
+ void initialize_st_bindings()
+ {   
+   console_set_key(CURS_UP,"\020"   , (char *)0, (char *)0);
+   console_set_key(CURS_DN,"\016"   , (char *)0, (char *)0);
+   console_set_key(CURS_LF,"\002"   , (char *)0, (char *)0);
+   console_set_key(CURS_RT,"\006"   , (char *)0, (char *)0);
+   console_set_key(K_UNDO, "logout ", "logout
", (char *)0);
+   console_set_key(K_HELP, "help "  , "help
", (char *)0);
+   console_set_key(K_INS,  "\t", "echo -en \"\\033E\\\033e
\" ", (char *)0);
+   console_set_key(0x2d,"x","X","\033x");
+ }
+ #endif
+ 
  /* Read a line of input.  Prompt with PROMPT.  A NULL PROMPT means
     none.  A return value of NULL means that EOF was encountered. */
  char *
***************
*** 529,535 ****
--- 567,580 ----
        }
  #else
  #if defined (HAVE_BSD_SIGNALS)
+ 
+ /**
+  ** (sjk)++ Quitely Ignored on the Atari ST (for now!)
+  **/
+ #if !defined(atarist)
        sigsetmask (0);
+ #endif
+ 
  #endif /* HAVE_BSD_SIGNALS */
  #endif /* _POSIX_VERSION */
  
***************
*** 678,687 ****
    long chars_avail;
    char input;
  
  #ifdef FIONREAD
    result = ioctl (tty, FIONREAD, &chars_avail);
  #endif
- 
    if (result == -1)
      {
        int flags;
--- 723,736 ----
    long chars_avail;
    char input;
  
+ /**
+  ** (sjk)++ For the Atari ST, we use the xconsole routines from termcap 
+  **         to do all the console I/O.                  (thanx Jwahar!)
+  **/
+ #if !defined(atarist)
  #ifdef FIONREAD
    result = ioctl (tty, FIONREAD, &chars_avail);
  #endif
    if (result == -1)
      {
        int flags;
***************
*** 695,704 ****
        if (chars_avail == -1 && errno == EAGAIN)
  	return;
      }
  
    /* If there's nothing available, don't waste time trying to read
       something. */
!   if (chars_avail == 0)
      return;
  
    tem = ibuffer_space ();
--- 744,764 ----
        if (chars_avail == -1 && errno == EAGAIN)
  	return;
      }
+ #endif 
+ #if defined(atarist)
+     if (console_input_status(tty) == 0)          /* tty = fileno(input) */
+       { chars_avail = -1; 
+         return;
+       }
+     else 
+       { chars_avail = 1;
+         input = (char)console_read_byte(tty);     /* tty = fileno(input) */
+       }
+ #endif
  
    /* If there's nothing available, don't waste time trying to read
       something. */
!   if (chars_avail < 1)
      return;
  
    tem = ibuffer_space ();
***************
*** 1038,1043 ****
--- 1098,1110 ----
  {
    extern char *rl_display_prompt;
  
+ /** 
+  ** (sjk)++ This is where the Atari ST key bindings are really initialized.
+  **/
+ #if defined(atarist)
+    initialize_st_bindings();
+ #endif
+ 
    /* If we have never been called before, initialize the
       terminal and data structures. */
    if (!rl_initialized)
***************
*** 1758,1764 ****
  	  putc (data[i], out_stream);
  #else
        for (i = last_c_pos; i < new; i++)
! 	putc (data[i], out_stream);
  #endif				/* HACK_TERMCAP_MOTION */
      }
    else
--- 1825,1831 ----
  	  putc (data[i], out_stream);
  #else
        for (i = last_c_pos; i < new; i++)
! 	  putc (data[i], out_stream);
  #endif				/* HACK_TERMCAP_MOTION */
      }
    else
***************
*** 2128,2134 ****
  
        for (i = 0; i < count; i++)
  	putc (' ', out_stream);
- 
        backspace (count);
      }
  }
--- 2195,2200 ----
***************
*** 2186,2191 ****
--- 2252,2267 ----
  #if !defined (ANYP)
  #define ANYP (EVENP | ODDP)
  #endif
+ 
+ /**
+  ** (sjk)++ On the Atari ST we set the terminal to (RAW || PASS8) mode 
+  **         to give 8bit Meta Key support.
+  **/
+ #if defined(atarist)
+        the_ttybuff.sg_flags |= (RAW || PASS8);
+ #define LPASS8 PASS8
+ #endif 
+ 
        /* If this terminal doesn't care how the 8th bit is used,
  	 then we can use it for the meta-key.
  	 We check by seeing if BOTH odd and even parity are allowed. */
***************
*** 2254,2260 ****
--- 2330,2343 ----
  #endif /* TIOCGLTC */
  
        the_ttybuff.sg_flags &= (~ECHO|CRMOD);
+ /** 
+  ** (sjk)++ Atari ST always should be in RAW mode
+  **/
+ #if !defined(atarist)
        the_ttybuff.sg_flags |= CBREAK;
+ #else
+       the_ttybuff.sg_flags |= RAW;
+ #endif
        ioctl (tty, TIOCSETN, &the_ttybuff);
  
        terminal_prepped = 1;
***************
*** 3790,3796 ****
  			  temp = matches[l];
  			else
  			  temp++;
- 
  			fprintf (out_stream, "%s", temp);
  			for (k = 0; k < max - strlen (temp); k++)
  			  putc (' ', out_stream);
--- 3873,3878 ----
***************
*** 5040,5045 ****
--- 5122,5135 ----
      {
        char *rindex (), *temp;
  
+ /**
+  ** (sjk)++ We need to alway close, then reopen the directory just
+  **         incase some external command wrote a Auto Symbolic link
+  **         that invalidates the symdir cache.
+  **/
+ #if defined(atarist)
+       _del_symdir_cache();
+ #endif
        if (dirname) free (dirname);
        if (filename) free (filename);
        if (users_dirname) free (users_dirname);
***************
*** 5075,5081 ****
  
        rl_filename_completion_desired = 1;
      }
! 
    /* At this point we should entertain the possibility of hacking wildcarded
       filenames, like /usr/man*\/te<TAB>.  If the directory name contains
       globbing characters, then build an array of directories to glob on, and
--- 5165,5171 ----
  
        rl_filename_completion_desired = 1;
      }
!  
    /* At this point we should entertain the possibility of hacking wildcarded
       filenames, like /usr/man*\/te<TAB>.  If the directory name contains
       globbing characters, then build an array of directories to glob on, and
***************
*** 5930,5936 ****
  {
    int result;
    unsigned char c;
! 
    while (1)
      {
        result = read (fileno (stream), &c, sizeof (char));
--- 6020,6030 ----
  {
    int result;
    unsigned char c;
! /**
!  ** (sjk)++ We again use the termcap xconsole routines to do input 
!  **         from the console.
!  **/
! #if !defined(atarist)
    while (1)
      {
        result = read (fileno (stream), &c, sizeof (char));
***************
*** 5941,5946 ****
--- 6035,6043 ----
        if (errno != EINTR)
  	return (EOF);
      }
+ #else 
+    result = console_read_byte(fileno(stream));
+ #endif 
  }
  
  #ifdef STATIC_MALLOC
